
package com.work.junit;

import java.sql.Time;
import java.util.Calendar;

import org.junit.Test;

import com.work.util.AppUtils;

public class ViewTest {

	@Test
	public void testTime()
	{
		Time _8_30 = AppUtils.createTime(8, 30, 0);
		Time _12_30 = AppUtils.createTime(12, 30, 0);
		Time _13_00 = AppUtils.createTime(13, 00, 0);
		Time _17_00 = AppUtils.createTime(17, 00, 0);

		Time lunch = AppUtils.getDifferenceBeetwenTime(_13_00, _12_30);
		Time timeInWork = AppUtils.getDifferenceBeetwenTime(_17_00, _8_30);
		Time timeWork = AppUtils.createTime(timeInWork.getTime() - lunch.getTime());

		System.out.println("LUNCH: " + lunch);
		System.out.println("TIME IN WORK: " + timeInWork);
		System.out.println("TIME WORK: " + timeWork);
	}
	
	@Test
	public void testTime2()
	{
		Time _8_30 = AppUtils.createTime(90, 30, 0);
		System.out.println("TIME WORK: " + _8_30);
	}
	
	@Test
	public void testTimeOrderValidator() {
		Time t1 = Time.valueOf("08:30:00");
		Time t2 = Time.valueOf("12:00:00");
		Time t3 = Time.valueOf("23:30:00");
		Time t4 = Time.valueOf("17:00:00");
		
		System.out.println(AppUtils.areTimesOrdered(t1,t2,t3,t4));
	}
	
	@Test
	public void testTimeDifference() {
		Time t1 = Time.valueOf("08:30:00");
		Time t2 = Time.valueOf("16:31:00");
		
		AppUtils.checkTimeDifference(t1, t2, Calendar.MINUTE, 480);
	}
}
